<template>
    <div>
        <weekend-header :title="title"></weekend-header>
        <weekend-content :list="detailList"></weekend-content>
    </div>
</template>

<script>
import WeekendHeader from './components/header'
import WeekendContent from './components/content'
import axios from 'axios'
export default {
    name: 'WeekendDetail',
    components: {
        WeekendHeader,
        WeekendContent
    },
    data () {
        return {
            detailList: [],
            title: '',
            num: 0
        }
    },
    mounted () {
        this.getDetailInfo()
    },
    methods: {
        getDetailInfo () {
            axios.get('/api/weekend.json', {
                params: {
                    id: this.$route.params.id
                }
            }).then(this.handleGetDataSucc)
            this.num = parseInt(this.$route.params.id)
        },
        handleGetDataSucc (res) {
            res = res.data
            if (res.ret && res.data) {
                const data = res.data[(this.num) - 1]
                this.title = data.title
                this.detailList = data.detailList
            }
        }
    }
}
</script>

<style lang="stylus" scoped>

</style>
